package ottoFebDuemilaundici;

import java.util.Iterator;

import positionList.Position;
import binaryTree.BTNode;

public class Esecuzione {
	public static void main(String[] args) {
		MyTree<Integer> albero = new MyTree<Integer>();
		Position<Integer> root = new BTNode<Integer>(1,null,null,null);
		stampa_prefissa(albero, root);
		
	}
	public static <E> void stampa_prefissa( Tree<E> T, Position<E> p ) {
		System.out.println(p.element());
		if(T.isInternal(p)) {
			System.out.println(" ( ");
			Iterator<Position<E>> figli =T.children(p);
			while(figli.hasNext()) {
				stampa_prefissa(T,figli.next());
			}
			System.out.println(" ) ");
		}
		
	}


}
